<!doctype html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>template</title>
</head>

<body>
  <input size="150" id="text" value="http://localhost:85/TOMCAT/finder-web/finder?action=api.key&host=127.0.0.1&workspace=webapps&path=pwd-web/index.jsp"/>
  <br></br>
  <button type="button" onclick="build()">generate</button>
  <b>click：</b><a id="downloadUrl" target="_blank"></a>


    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://fastly.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
</body>

</html>

<script type="text/javascript">
  function build() {
    var text = encodeURI($("#text").val());
      console.log(text);
    $.ajax({
      url: text,
      success:function(rel) {
        if (rel.status != 200) {
          alert(rel.message);
          return;
        }
        var url = "http://localhost:85/TOMCAT/finder-web/finder?action=api.download&key=" + rel.value;
        $("#downloadUrl").attr("href", url);
        $("#downloadUrl").html(url);
      }
    })
  }
</script>